Skip to content

Instantly share code, notes, and snippets.

Avatar

wwj718

View GitHub Profile
View history.txt
I was drawn to programming, science, technology and science fiction
ever since I was a little kid. I can't say it's because I wanted to
make the world a better place. Not really. I was simply drawn to it
because I was drawn to it. Writing programs was fun. Figuring out how
nature works was fascinating. Science fiction felt like a grand
adventure.
Then I started a software company and poured every ounce of energy
into it. It failed. That hurt, but that part is ok. I made a lot of
mistakes and learned from them. This experience made me much, much
View check_quotes.py
import sys
import tokenize
class DoubleQuotesChecker:
msg = "single quotes detected, use double quotes instead"
def __init__(self):
self.violations = []
def find_violations(self, filename, tokens):
@shakna-israel
shakna-israel / Prose.md
Last active Sep 22, 2020
Obfuscating Python
View Prose.md

Obfuscating Python

Obfuscation isn't difficult in most programming languages. It's why we have "good practices" because it is so easy to hide what you mean in badly written code.

Obfuscation tends to be even easier in dynamic languages because of how forgiving they tend to be - and because they tend to give you direct access to the environment so that you can manipulate it.

Today, for fun, I'm going to obfuscate this code:

def _(n):
    if n <= 0:
@shaunlebron
shaunlebron / realtalk.md
Last active Sep 2, 2020
why Dynamicland Realtalk isn't open source
View realtalk.md

Transcribed from an interview with Toby Schachman and Paula Te on The Afrofuturist Podcast:

There's this notion of the open-source movement. There are a lot of things
that we totally resonate with that because it's about understanding how your
technology works. We're totally 100% on board with that.

But then there are other issues with the open-source community, where it's
very internet-based and so open-source ends up benefitting this group of
people who have really strong access to internet and understand how to use
@matthewearl
matthewearl / smblevextract.py
Last active Aug 24, 2020
Super Mario Bros Level Extractor
View smblevextract.py
#!/usr/bin/env python3
#
# Copyright (c) 2018 Matthew Earl
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@bee-san
bee-san / timsort.py
Last active Mar 20, 2020
An Python implementation of Timsort
View timsort.py
# based off of this code https://gist.github.com/nandajavarma/a3a6b62f34e74ec4c31674934327bbd3
# Brandon Skerritt
# https://skerritt.tech
def binary_search(the_array, item, start, end):
if start == end:
if the_array[start] > item:
return start
else:
return start + 1
View gist:26a5c058a2b943588e9fcafbff423542
备份镜像
查看sd卡的路径
df -h
备份镜像到磁盘
sudo dd if=/dev/树莓派设备地址 | gzip>/home/你的用户名/文件名.gz
例子
sudo dd if=/dev/disk2 | gzip > /Users/hidaris/rpi_opencv3_41_hass.gz
@nileshtrivedi
nileshtrivedi / programming.md
Last active Dec 8, 2020
Programming: Mostly A Hate Story
View programming.md

Programming: Mostly A Hate Story

I wanted to do digital signatures validation, preferably ed25519, inside PostgreSQL triggers. Here is how it went:

Surely pgcrypto must be supporting it, right? Most Postgres cloud hosting providers already support pgcrypto so this would be perfect. Right?

Well, pgcrypto only supports PGP and that too excludes digital signatures. Let's give PGP a try anyway and see how far can we go.

Installed gpg to generate the keys and the experience is less than pleasant. Sometimes it gets stuck at the passphrase prompt. The keys are too big, but still I can make pgcrypto's pgp_pub_encrypt and pgp_pub_decrypt methods work. Just remeber to convert keys in ASCII to binary and vice-versa using armor()/dearmor(). I hate the big key size in RSA, even though GPG defaults to 2048-bit keys and not the more secure 4096-bit ones. Let's look into ed25519 now.

@me00016
me00016 / COZMO conversing using ChatterBot 0.7.6
Last active Aug 14, 2020
COZMO conversing using ChatterBot 0.7.6
View COZMO conversing using ChatterBot 0.7.6
#!/usr/bin/env python3
# Copyright (c) 2016 Anki, Inc. (except Chatterbot part and a couple of my
# own lines of code)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License in the file LICENSE.txt or at
#
# http://www.apache.org/licenses/LICENSE-2.0
View docker-compose.yml
version: '3'
services:
postgres:
image: postgres:9.4-alpine
volumes:
- ./pgdata_new:/var/lib/postgresql/data
ports:
- '127.0.0.1:5432:5432'
elasticsearch:
#image: wwj2
You can’t perform that action at this time.