Skip to content

Instantly share code, notes, and snippets.

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

Juan Diego Godoy Robles klashxx

💭
I may be slow to respond.
View GitHub Profile

JS Tricks

Consecutive letter array

Array.from(new Array(6),(_,index)=> String.fromCharCode('a'.charCodeAt(0) + index))

Results

const httpLink = createHttpLink({
uri: '/graphql',
credentials: 'same-origin',
});
const authLink = setContext((_, { headers }) => {
return {
headers: {
...headers,
'Accept': 'application/json',
from django.contrib.sessions.models import Session
from account.models import Usuario
for s in Session.objects.all():
print (s)
uid = s.get_decoded().get('_auth_user_id')
if uid is None:
continue
user = Usuario.objects.get(pk=uid)
print (user.username, user.get_full_name())
@klashxx
klashxx / decode.py
Last active November 19, 2018 13:11
from Crypto.Cipher import AES
from base64 import b64encode, b64decode
hdr = b'To your eyes only'
plaintext = b'Attack at dawn'
key = b'Sixteen byte key'
cipher = AES.new(key, AES.MODE_CCM)
cipher.update(hdr)
msg = cipher.nonce, hdr, cipher.encrypt(plaintext), cipher.digest()
{
"created_at":"Wed Dec 20 18:48:15 +0000 2017",
"id":943553649212575744,
"id_str":"943553649212575744",
"text":"@RunTaehyungRun Quedan todos machucados y para que? Para nada. Ya de por si andan cansados de tanta practica y esto\u2026 https:\/\/t.co\/d2aykVI2FA",
"display_text_range":[
16,
140
],
"source":"\u003ca href=\"http:\/\/twitter.com\/download\/android\" rel=\"nofollow\"\u003eTwitter for Android\u003c\/a\u003e",
{
"rate_limit_context":{
"access_token":"----------"
},
"resources":{
"lists":{
"/lists/list":{
"limit":15,
"remaining":15,
"reset":1513701801
{
"created_at":"Tue Dec 19 16:20:28 +0000 2017",
"id":943154072772907008,
"id_str":"943154072772907008",
"text":"RT @LATERMICA: \u00bfEst\u00e1s preparado\/a para disfrutar de NOCHEBUENA con nosotros? Tenemos novedades y es que este a\u00f1o \ud83c\udf89\ud83c\udf89\u00a1LA ENTRADA ES\u2026 ",
"source":"\u003ca href=\"http:\/\/twitter.com\/download\/android\" rel=\"nofollow\"\u003eTwitter for Android\u003c\/a\u003e",
"truncated":false,
"in_reply_to_status_id":null,
"in_reply_to_status_id_str":null,
"in_reply_to_user_id":null,
@klashxx
klashxx / twitter.json
Created December 19, 2017 11:39 — forked from hrp/twitter.json
Example JSON response from Twitter streaming API
{
"text": "RT @PostGradProblem: In preparation for the NFL lockout, I will be spending twice as much time analyzing my fantasy baseball team during ...",
"truncated": true,
"in_reply_to_user_id": null,
"in_reply_to_status_id": null,
"favorited": false,
"source": "<a href=\"http://twitter.com/\" rel=\"nofollow\">Twitter for iPhone</a>",
"in_reply_to_screen_name": null,
"in_reply_to_status_id_str": null,
"id_str": "54691802283900928",
@klashxx
klashxx / structure-of-tweepy-status-object.json
Created December 16, 2017 17:06
the structure of the Status object of Tweepy
/* json.dumps(StatusObject._json) */
{
"created_at": "Thu Jul 28 00:08:39 +0000 2016",
"in_reply_to_status_id": null,
"id_str": "758454081656467456",
"retweeted": false,
"entities": {
"hashtags": [
{
@klashxx
klashxx / gaps.awk
Last active November 11, 2017 11:45
awk 'FNR==1{n=$3+1;print;next}
{while(n<$3+0){
print $1",00."n",0.00000"
n++
}
print
n=$3+1}' FS=',|:' fichero