Skip to content

Instantly share code, notes, and snippets.

@ctrngk
ctrngk / BasicERC20.sol
Created August 4, 2021 14:20 — forked from staringispolite/BasicERC20.sol
Basic ERC20 implementation
pragma solidity >=0.4.22 <0.6.0;
contract ERC20Basic {
string public constant name = "JonCoin";
string public constant symbol = "JH";
uint8 public constant decimals = 18;
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
@ctrngk
ctrngk / server.conf
Created December 31, 2020 12:16 — forked from iliakan/server.conf
Nginx configuration for separated frontend and backend endpoints
upstream example-webpack {
server 127.0.0.1:8080;
}
upstream example-backend {
server 127.0.0.1:3000;
}
server {
listen 80;
@ctrngk
ctrngk / .env.local
Created December 15, 2020 10:09
with-firebase-authentication-app
# Update these with your Firebase app's values.
# Your Project -> Service accounts -> Firebase Admin SDK -> Private Key
NEXT_PUBLIC_FIREBASE_PROJECT_ID=***
FIREBASE_PRIVATE_KEY=-----BEGIN PRIVATE KEY-----***
FIREBASE_CLIENT_EMAIL=firebase-adminsdk@***
# Your APP -> Firebase SDK snippet -> config
NEXT_PUBLIC_FIREBASE_PUBLIC_API_KEY=AIza***
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=***.firebaseapp.com
This file has been truncated, but you can view the full file.
/*!
* @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md.
*/
(function(t){const e=t["en"]=t["en"]||{};e.dictionary=Object.assign(e.dictionary||{},{"%0 of %1":"%0 of %1","Align cell text to the bottom":"Align cell text to the bottom","Align cell text to the center":"Align cell text to the center","Align cell text to the left":"Align cell text to the left","Align cell text to the middle":"Align cell text to the middle","Align cell text to the right":"Align cell text to the right","Align cell text to the top":"Align cell text to the top","Align center":"Align center","Align left":"Align left","Align right":"Align right","Align table to the left":"Align table to the left","Align table to the right":"Align table to the right",Alignment:"Alignment","Almost equal to":"Almost equal to",Angle:"Angle","Approximately equal to":"Approximately equal to",Aquamarine:"Aquamarine","Asterisk operator":"Asterisk operator","Austral sign":"Austral sign","back wi
@ctrngk
ctrngk / anki_algorithm.js
Last active October 1, 2020 02:24 — forked from riceissa/anki_algorithm.py
my current understanding of Anki's spacing algorithm
// https://gist.github.com/riceissa/1ead1b9881ffbb48793565ce69d7dbdd
// "New cards" tab
const NEW_STEPS = [15, 25, 35] // in minutes
const GRADUATING_INTERVAL = 15 // in days
const EASY_INTERVAL = 4 // in days
const STARTING_EASE = 2.50 // in percent
// "Reviews" tab
@ctrngk
ctrngk / Python TCP Client Example.py
Created February 11, 2020 04:25 — forked from Integralist/Python TCP Client Example.py
Python TCP Client Server Example
import socket
hostname, sld, tld, port = 'www', 'integralist', 'co.uk', 80
target = '{}.{}.{}'.format(hostname, sld, tld)
# create an ipv4 (AF_INET) socket object using the tcp protocol (SOCK_STREAM)
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# connect the client
# client.connect((target, port))
@ctrngk
ctrngk / output-demo.json
Created January 11, 2020 06:03
output.json demo from google vision pdf_detection
{
"inputConfig": {
"gcsSource": {
"uri": "gs://example_bucket_1_test_only/pictures/jptest2.pdf"
},
"mimeType": "application/pdf"
},
"responses": [
{
"fullTextAnnotation": {
@ctrngk
ctrngk / t.m
Created October 9, 2018 11:37 — forked from amitu/t.m
changing mac input source (language)
#import <Foundation/Foundation.h>
#import <Carbon/Carbon.h>
/*###############################################################################
# #
# changeInput #
# #
# author: Stefan Klieme (based on an idea by Craig Williams) #
# created: 2009-11-05 #
# Changes input language #
# Usage: changeInput prints current input language #
/* Trivial keyboard input layout to english switcher by Alexander V. Zhouravlev.
* Compile it with gcc -framework Carbon -o SwitchToEnglish SwitchToEnglish.m */
#import <Carbon/Carbon.h>
int main (int argc, const char *argv[])
{
TISInputSourceRef english = TISCopyInputSourceForLanguage(CFSTR("en-US"));
if (!english)
return 1;
@ctrngk
ctrngk / ShadowsocksRandomMultiport
Created September 23, 2018 10:10
shadowsocks多端口随机
#ss-server 服务端(假设你的目前的服务端 ss 端口已经监听在 23 端口):
#-----------开始--------------
iptables -t nat -A PREROUTING -p tcp -m multiport --dport 81:1023 -j REDIRECT --to-ports 23
iptables -t nat -A PREROUTING -p udp -m multiport --dport 81:1023 -j REDIRECT --to-ports 23
#以下两条命令可选
service iptables save
service iptables restart
#-----------结束--------------
#ss-redir 本地端(104.224.156.199 自行修改成自己服务器 ip):