Skip to content

Instantly share code, notes, and snippets.

View Jeiwan's full-sized avatar
🛠️
Write code, delete code, repeat

Ivan Kuznetsov Jeiwan

🛠️
Write code, delete code, repeat
View GitHub Profile
object "Contract" {
code {
datacopy(0, dataoffset("runtime"), datasize("runtime"))
return(0, datasize("runtime"))
}
object "runtime" {
code {
if iszero(calledByOwner()) { revert(0, 0) }
switch selector()
case 0x00 {
@Jeiwan
Jeiwan / README.md
Created November 5, 2021 09:30 — forked from moonmilk/README.md
manually authorize a twitter app to a twitter account

So you're writting a twitterbot and you need to authorize your application to post to the account. You need an access token and secret for the account you're posting to. If the posting account is the same account that owns the application, no problem, you just push the button on your application's settings page to make the keys. But if you want to post to a different twitter account, there's no UI on apps.twitter.com to authorize it. So I made this bare-minimum node server to run through the authorization process. There's probably a much better way to do this, so please let me know what that way is!

ignore this and go down to the comments for better solutions

  • You'll need a server with node.js!
  • Make sure your application has a callback URL specified in its settings page, even if it's just a placeholder. If there's nothing in the callback URL slot, this method of authorization won't work.
  • In authorize.js, fill in your application's consumer key and secret, and the domain on which you'll be running th

Identifying Arbitrage Opportunities with Graphs


Introduction

@Jeiwan
Jeiwan / graceful.go
Created July 6, 2018 06:54 — forked from peterhellberg/graceful.go
*http.Server in Go 1.8 supports graceful shutdown. This is a small example.
package main
import (
"context"
"log"
"net/http"
"os"
"os/signal"
"time"
)
@Jeiwan
Jeiwan / gist:e14d00f8c17db7b449585101472b6bd2
Created March 2, 2018 09:44 — forked from clintel/gist:1155906
Fenced code in bullet lists with GitHub-flavoured MarkDown??

Fenced code blocks inside ordered and unordered lists

  1. This is a numbered list.

  2. I'm going to include a fenced code block as part of this bullet:

    Code
    More Code
    
@Jeiwan
Jeiwan / README.md
Created January 3, 2018 07:30 — forked from e7d/README.md
[Debian] Setup a Squid anonymous proxy
@Jeiwan
Jeiwan / docker-cleanup-resources.md
Created December 19, 2017 01:46 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@Jeiwan
Jeiwan / core.clj
Created July 5, 2017 00:55
Custom log4j appender in Clojure
(ns woof.core
(:gen-class)
(:require [clojure.tools.logging :as log])
(:import StringAppender))
(defn -main
"I don't do a whole lot ... yet."
[& args]
(log/info "Hello, world!")
(println "Done")
@Jeiwan
Jeiwan / nginx_reverse_proxy.conf
Created February 19, 2017 09:01
NGINX reverse proxy with SSL
events {
worker_connections 1024;
}
http {
server {
listen 80;
listen 443 default ssl;
server_name SERVER_NAME;
@Jeiwan
Jeiwan / s3_object_tagging.clj
Created January 31, 2017 08:13
S3 Object Tagging with Amazonica
(require '[amazonica.aws.s3 :as s3])
(import '[com.amazonaws.services.s3.model Tag ObjectTagging])
(def bucket "bucket")
(def kkey "key")
(def file (clojure.java.io/file "file"))
(defn tags->tagging [tags]
(->> tags
clojure.walk/stringify-keys