Skip to content

Instantly share code, notes, and snippets.

View kiruto's full-sized avatar

Yuriel Arlencloyn kiruto

View GitHub Profile
@kiruto
kiruto / AsyncAwait.swift
Created December 21, 2018 04:20
swift 4 async / await
//
// Created by Kiruto on 2018-12-21.
//
import Foundation
struct Await<T> {
// private
fileprivate let group: DispatchGroup
fileprivate let getResult: () -> T
#!/bin/bash
# Install Shadowsocks on CentOS 7
echo "Installing Shadowsocks..."
random-string()
{
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-32} | head -n 1
}
@kiruto
kiruto / private.xml
Created May 14, 2017 01:52
karabiner
<?xml version="1.0"?>
<root>
<item>
<name>ろ to ~</name>
<identifier>private.change_RO_to_BACKQUOTE</identifier>
<autogen>__KeyToKey__ KeyCode::JIS_UNDERSCORE, KeyCode::BACKQUOTE</autogen>
</item>
<item>
<name>VK_CHANGE_INPUTSOURCE_CHINESE_SIMPLIFIED</name>
@kiruto
kiruto / isChinaIP.py
Created January 9, 2017 04:23 — forked from xixitalk/isChinaIP.py
算法:判断是否是中国IP
#/usr/bin/python
#coding: utf-8
# file: http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest
global_ip_dict = [[[] for col in range(256)] for row in range(256)]
#input:apnic|CN|ipv4|112.0.0.0|4194304|20081215|allocated
#output:addr1,addr2,addr3,addr4,ip_num
def analyseLine(ip_line):
ip_str_list = ip_line.split('|')
@kiruto
kiruto / index.md
Created December 21, 2016 07:13 — forked from mathisonian/index.md
requiring npm modules in the browser console

demo gif

The final result: require() any module on npm in your browser console with browserify

This article is written to explain how the above gif works in the chrome (and other) browser consoles. A quick disclaimer: this whole thing is a huge hack, it shouldn't be used for anything seriously, and there are probably much better ways of accomplishing the same.

Update: There are much better ways of accomplishing the same, and the script has been updated to use a much simpler method pulling directly from browserify-cdn. See this thread for details: mathisonian/requirify#5

inspiration

from sentry.conf.server import *
import os.path
CONF_ROOT = os.path.dirname(__file__)
DATABASES = {
'default': {
# You can swap out the engine for MySQL easily by changing this value
# to ``django.db.backends.mysql`` or to PostgreSQL with
# ``django.db.backends.postgresql_psycopg2``
@kiruto
kiruto / ServiceSinkhole.java
Created September 14, 2016 03:31
netguard VpnService
package eu.faircode.netguard;
/*
This file is part of NetGuard.
NetGuard is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
NetGuard is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@kiruto
kiruto / private.xml
Created August 28, 2016 15:29
Karabiner settings
<?xml version="1.0"?>
<root>
<item>
<name>ろ to ~</name>
<identifier>private.change_RO_to_BACKQUOTE</identifier>
<autogen>__KeyToKey__ KeyCode::JIS_UNDERSCORE, KeyCode::BACKQUOTE</autogen>
</item>
<item>
<name>VK_CHANGE_INPUTSOURCE_CHINESE_SIMPLIFIED</name>