Skip to content

Instantly share code, notes, and snippets.

Avatar

Avelino avelino

View GitHub Profile
@avelino
avelino / JGitUtil.java
Created Dec 20, 2019 — forked from porcelli/JGitUtil.java
jgit on bare repo
View JGitUtil.java
public static void delete(final Git git, final String branchName, final String path,
final String name, final String email, final String message, final TimeZone timeZone, final Date when) {
commit(git, branchName, path, null, name, email, message, timeZone, when);
}
public static void commit(final Git git, final String branchName, final String path, final File file,
final String name, final String email, final String message, final TimeZone timeZone, final Date when) {
final String gitPath = fixPath(path);
View zapier_next_working_date.py
from datetime import datetime
github_date = datetime.strptime(input_data['github_date_str'], '%Y-%m-%dT%H:%M:%SZ')
weeknumber = int(github_date.strftime("%w"))
task_date = 'tuesday'
if weeknumber >= 4 and weeknumber <= 5:
task_date = 'thursday'
return {'task_date': task_date}
View gist:982a50d0e7f942825f08278ff2ce1397
info: Hooks handler stderr: Traceback (most recent call last):
File "/Users/avelino/.virtualenvs/dredd/bin/dredd-hooks-python", line 13, in <module>
info: Hooks handler stderr: dredd.main(sys.argv[1:])
File "/Users/avelino/.virtualenvs/dredd/lib/python2.7/site-packages/dredd_hooks/dredd.py", line 246, in main
load_hook_files(a)
File "/Users/avelino/.virtualenvs/dredd/lib/python2.7/site-packages/dredd_hooks/dredd.py", line 142, in load_hook_files
info: Hooks handler stderr: module = imp.load_source(os.path.basename(path), real_path)
File "/Users/avelino/src/github.com/nuveo/publicapi/hooks.py", line 60
View proxymesh.py
#!/usr/bin/env python
import requests
import base64
proxies = {
'http': 'http://avelino:PASS@us-wa.proxymesh.com:31280',
'https': 'http://avelino:PASS@us-wa.proxymesh.com:31280'
}
View gist:c2431df98ed990c546c0e68ad0873f98
λ ~/test/ tree
.
├── adapters
│   ├── adapters.go
│   ├── mongodb
│   │   └── mongodb.go
│   └── postgres
│   └── postgres.go
├── helpers
│   └── herlpers.go
View factorial.go
package main
import "fmt"
func fact(n int) int {
if n == 0 {
return 1
}
return n * fact(n-1)
}
View factorial.c
#include <stdio.h>
int fac(int);
int fac(int n) {
if (n == 0) {
return 1;
}
return n * fac(n - 1);
}
View factorial.py
#!/usr/bin/env python
# https://avelino.xxx/golang-c-and-python-the-benchmark-time/
def fac(n):
if n == 0:
return 1
return n * fac(n - 1)
if __name__ == "__main__":
t = 0
View main.py
# https://avelino.xxx/go-vs-python-more-request-per-second/
import falcon
class ThingsResource:
def on_get(self, req, resp):
resp.status = falcon.HTTP_200
resp.body = ("Hello World")
app = falcon.API()
View main.go
// https://avelino.xxx/go-vs-python-more-request-per-second/
package main
import (
"fmt"
"net/http"
)
func main() {
http.HandleFunc("/", viewHandler)