Skip to content

Instantly share code, notes, and snippets.

View FlowerWrong's full-sized avatar
💭
I may be slow to respond.

浮生 FlowerWrong

💭
I may be slow to respond.
View GitHub Profile
@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
#include <stdio.h>
#include <stdlib.h>
#include <poll.h>
#include <uv.h>
static void on_close(uv_handle_t* handle);
static void on_connect(uv_connect_t* req, int status);
static void on_write(uv_write_t* req, int status);
static void on_alloc(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf)
@iamgreaser
iamgreaser / kkrotchbulge.c
Created November 11, 2015 21:05
kkrotchbulge - SDL2+GL capture on Linux & BSD
// kkrotchbulge: a cheap nasty hack to capture 60fps vids on Linux & BSD systems / GreaseMonkey, 2015 - Public Domain
// note, only does video right now, and only handles SDL2 + GL.
// compile+render: cc -fPIC -shared -o libkkrotchbulge.so kkrotchbulge.c -I/usr/local/include `sdl2-config --cflags` -L/usr/local/lib -lGL && env LD_PRELOAD=./libkkrotchbulge.so ./tfiy
// transcode (in another terminal): ffmpeg -s 1280x720 -r 60 -pix_fmt rgba -f rawvideo -i kkrotchbulge-out-vid tfiy-vid.mkv
// combine audio: ffmpeg -i tfiy-vid.mkv -i dat/ds15rel-gm.ogg -acodec copy -vcodec copy tfiy-60fps.mkv
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <errno.h>
@rickyzhang-cn
rickyzhang-cn / simpletun.c
Created April 27, 2015 09:08
一个简单的使用tun/tap建立tunnel的示例代码
/**************************************************************************
* simpletun.c *
* *
* A simplistic, simple-minded, naive tunnelling program using tun/tap *
* interfaces and TCP. Handles (badly) IPv4 for tun, ARP and IPv4 for *
* tap. DO NOT USE THIS PROGRAM FOR SERIOUS PURPOSES. *
* *
* You have been warned. *
* *
* (C) 2009 Davide Brini. *
@zqqf16
zqqf16 / IPSecDemo.m
Last active May 29, 2020 08:11
Start IPSec programmatically in iOS 8
- (void)viewDidLoad
{
[super viewDidLoad];
// init VPN manager
self.vpnManager = [NEVPNManager sharedManager];
// load config from perference
[_vpnManager loadFromPreferencesWithCompletionHandler:^(NSError *error) {
@deepakkumarnd
deepakkumarnd / server_setup.sh
Last active April 3, 2020 15:14
Server setup script
# This script has to be run as a root user
echo "* Updating system"
apt-get update
apt-get -y upgrade
echo "* Installing packages"
apt-get -y install build-essential libmagickcore-dev imagemagick libmagickwand-dev libxml2-dev libxslt1-dev git-core nginx redis-server curl nodejs htop
id -u deploy &> /dev/null
if [ $? -ne 0 ]
@dirkmoors
dirkmoors / procedure
Last active June 22, 2016 19:29
ejabberd 13.12 Build from source + Ubuntu 14.04LTS installation
• Node 1, 2, … X
○ sudo su -l
○ cd
○ apt-get update
○ apt-get upgrade
○ apt-get install git-core
○ apt-get install libyaml-dev
○ apt-get install erlang
○ apt-get install unzip
○ apt-get build-dep ejabberd
@xpepper
xpepper / Massive file upload using JQueryUpload + Nginx + Rails + Sidekiq.md
Last active December 13, 2023 01:00
Massive file upload using JQueryUpload + Nginx + Rails + Sidekiq

Massive file upload using JQueryUpload + Nginx + Rails + Sidekiq

The goal: Upload several files (virtually big files) to a Rails application without compromising the user experience.

Architecture

jQuery File Upload + Nginx + Rails (Carrierwave) + Sidekiq

  1. jQuery File Upload (http://blueimp.github.io/jQuery-File-Upload/)
@skinofstars
skinofstars / feature_macros.rb
Created April 9, 2014 17:36
RSpec + Capybara + Devise + Factory Girl: login macro
# support/feature_macros.rb
module FeaturesMacros
def signin_admin
DatabaseCleaner.clean
@user ||= FactoryGirl.create(:user)
visit '/sign_in'
within("#new_user") do
fill_in 'user[email]', :with => user.email
@denji
denji / README.md
Last active April 26, 2024 18:09 — forked from istepanov/gist:3950977
Remove/Backup – settings & cli for macOS (OS X) – DataGrip, AppCode, CLion, Gogland, IntelliJ, PhpStorm, PyCharm, Rider, RubyMine, WebStorm