Skip to content

Instantly share code, notes, and snippets.

View styx's full-sized avatar
🌴
¯\_(ツ)_/¯

Mikhail S. Pabalavets styx

🌴
¯\_(ツ)_/¯
View GitHub Profile
@Dr-Nikson
Dr-Nikson / README.md
Last active June 8, 2023 12:04
Auth example (react + redux + react-router)
@helderco
helderco / db-open
Created October 6, 2015 14:51
Script to open a mysql database in Sequel Pro from a service in docker-compose.
#!/bin/bash
set -e
show_help() {
cat << EOF
Usage: ${0##*/} [-u USER] [-p PASS] [-P PORT] [-H HOST] [DATABASE]
${0##*/} -h
Open a standard connection in Sequel PRO.
@tmaier
tmaier / bootstrap_topbar_list.rb
Created January 2, 2012 11:08
BootstrapTopbarList for simple-navigation and Twitter Bootstrap integration
# Renders an ItemContainer as a <ul> element and its containing items as <li> elements.
# Prepared to use inside the topbar of Twitter Bootstrap http://twitter.github.com/bootstrap/#navigation
#
# Register the renderer and use following code in your view:
# render_navigation(level: 1..2, renderer: :bootstrap_topbar_list, expand_all: true)
class BootstrapTopbarList < SimpleNavigation::Renderer::Base
def render(item_container)
if options[:is_subnavigation]
ul_class = "dropdown-menu"
@mrrooijen
mrrooijen / Capistrano-Deployment-Recipe.rb
Created July 29, 2009 09:34
a "base" Capistrano Rails Deployment Recipe. Use it to deploy your Rails application. It is also easily expandable. So feel free to grab this Recipe and add your own tasks/customization!
# Guide
# Configure the essential configurations below and do the following:
#
# Repository Creation:
# cap deploy:repository:create
# git add .
# git commit -am "initial commit"
# git push origin master
#
# Initial Deployment:
@Rottweiler
Rottweiler / gist:44fe4461a4552acf303a
Last active January 18, 2023 10:49
Heavily obfuscated UnConfuserEx tool
UnConfuserEx https://mega.nz/#!U1hxwQKb!7WFBSjrZgg8ieFp15K0RJW8rWuyMHZTO9bpCekhBQfY
ConfuserExDupPopPatcher https://mega.nz/#!IkhHzZDS!vPYABdYJtuDIGJBHdKzwIqLajxugJaNlENWr5CWjNlo
ConfuserExStringDecryptor https://mega.nz/#!plhxRJyY!Vq9eRS-gixC__q75860gDD8Tcm_ncOfCCCP_HQKguUM
ConfuserExCallFixer https://mega.nz/#!0gZFlbwC!KFka_Kxe-GuU-d8COni91xmGPbiRnbX6lBLYAomn7No
I'm not responsible for what you do with these -- they may very well be backdoored
@defunkt
defunkt / connection_fix.rb
Created November 19, 2009 20:00
MySQL server has gone away fix
# If your workers are inactive for a long period of time, they'll lose
# their MySQL connection.
#
# This hack ensures we re-connect whenever a connection is
# lost. Because, really. why not?
#
# Stick this in RAILS_ROOT/config/initializers/connection_fix.rb (or somewhere similar)
#
# From:
# http://coderrr.wordpress.com/2009/01/08/activerecord-threading-issues-and-resolutions/
@brianhempel
brianhempel / bench_rails_memory_usage.rb
Last active October 6, 2022 12:47
A script to test the memory usage of your Rails application over time. It will run 30 requests against the specified action and report the final RSS. Choose the URL to hit on line 45 and then run with `ruby bench_rails_memory_usage.rb`.
require "net/http"
def start_server
# Remove the X to enable the parameters for tuning.
# These are the default values as of Ruby 2.2.0.
@child = spawn(<<-EOC.split.join(" "))
XRUBY_GC_HEAP_FREE_SLOTS=4096
XRUBY_GC_HEAP_INIT_SLOTS=10000
XRUBY_GC_HEAP_GROWTH_FACTOR=1.8
XRUBY_GC_HEAP_GROWTH_MAX_SLOTS=0
@ptrv
ptrv / spatialite_example.go
Last active September 8, 2022 02:48
SpatiaLite example in Go
package main
import (
"database/sql"
"github.com/mattn/go-sqlite3"
"log"
"os"
)
func runQuery(db *sql.DB, query string) {
@pomeo
pomeo / screencast.sh
Created September 4, 2011 14:54
script to make screencasts on Linux
#!/bin/bash
# list of programs we depend on
progs="xdpyinfo grep head sed ffmpeg pacat parec sox"
# check for programs we depend on
result=0
for prog in $progs
do
type -p $prog > /dev/null
@tonymtz
tonymtz / gist:714e73ccb79e21c4fc9c
Created November 15, 2014 00:02
Uninstall XQuartz.app from OSX Yosemite
launchctl unload /Library/LaunchAgents/org.macosforge.xquartz.startx.plist
sudo launchctl unload /Library/LaunchDaemons/org.macosforge.xquartz.privileged_startx.plist
sudo rm -rf /opt/X11* /Library/Launch*/org.macosforge.xquartz.* /Applications/Utilities/XQuartz.app /etc/*paths.d/*XQuartz
sudo pkgutil --forget org.macosforge.xquartz.pkg
# Log out and log in