Skip to content

Instantly share code, notes, and snippets.

@shakna-israel
shakna-israel / Prose.md
Last active January 6, 2025 17:00
Obfuscating Python

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:

import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
class Destination {
const Destination(this.index, this.title, this.icon, this.color);
final int index;
final String title;
final IconData icon;
final MaterialColor color;
}
@slightfoot
slightfoot / rubber_range_picker.dart
Last active January 19, 2023 01:09
Rubber Range Picker - Based on https://dribbble.com/shots/6101178-Rubber-Range-Picker-Open-Source by Cuberto - 14th March 2019
import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/scheduler.dart';
void main() => runApp(ExampleApp());
class ExampleApp extends StatelessWidget {
@override
@bee-san
bee-san / timsort.py
Last active August 15, 2021 10:28
An Python implementation of Timsort
# 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
@SylvanasSun
SylvanasSun / simhash.py
Created January 30, 2018 10:57
In computer science, SimHash is a technique for quickly estimating how similar two sets are. The algorithm is used by the Google Crawler to find near duplicate pages. It was created by Moses Charikar.
# Created by SylvanasSun in 2017.10.17
# !/usr/bin/python
# -*- coding: utf-8 -*-
import collections
import jieba
from jieba import analyse
# TODO: Change default hash algorithms to the other algorithms of high-performance.
@odemolliens
odemolliens / sim-run.sh
Created December 23, 2016 08:02 — forked from shazron/sim-run.sh
Run Xcode Simulator project from the command line XCode 8
#!/bin/bash
#
# Build and iPhone Simulator Helper Script
# Shazron Abdullah 2011
#
# WARN: - if your .xcodeproj name is not the same as your .app name,
# this won't work without modifications
# - you must run this script in where your .xcodeproj file is
PROJECTNAME=$1
@lazymutt
lazymutt / report_critical_update_versions.py
Last active May 3, 2023 08:01
parses update versions, some managed by `sudo softwareupdate --background-critical`, ported from an applescript found at https://www.jamf.com/jamf-nation/discussions/19111/xprotect-status-extension-attribute
#!/usr/bin/python
# Copyright (c) 2019 University of Utah Student Computing Labs. ################
# All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and
# its documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appears in all copies and
# that both that copyright notice and this permission notice appear
# in supporting documentation, and that the name of The University
@dedeexe
dedeexe / StringMaskFormatter.swift
Last active July 12, 2019 11:34
Simples And Fast String Mask Formatter.
//
// StringMaskFormatter.swift
// StringMaskFormatter
//
// Created by dede.exe on 10/07/16.
// It's totally base on article : "http://vojtastavik.com/2015/03/29/real-time-formatting-in-uitextfield-swift-basics/"
// And I don't mind if the original author should allow me(or not) to publish it :)... But I'll keep the reference
//
import UIKit
@torinkwok
torinkwok / GuiKitsMainThreadGuard.m
Last active April 15, 2016 14:10 — forked from steipete/PSPDFUIKitMainThreadGuard.m
This is a guard that tracks down AppKit/UIKit access on threads other than main. This snippet is taken from the commercial iOS PDF framework http://pspdfkit.com, but relicensed under MIT. Works because a lot of calls internally call setNeedsDisplay or setNeedsLayout. Won't catch everything, but it's very lightweight and usually does the job.You …
// Taken from the commercial iOS PDF framework http://pspdfkit.com.
// Copyright (c) 2016 Tong Kuo. All rights reserved.
// Licensed under MIT (http://opensource.org/licenses/MIT)
// Copyright (c) 2014 Peter Steinberger, PSPDFKit GmbH. All rights reserved.
// Licensed under MIT (http://opensource.org/licenses/MIT)
//
#if !RELEASE
@zchee
zchee / build-llvm.bash
Last active April 25, 2025 03:21
Build llvm for OS X
#!/bin/bash
set -e
# Building LLVM on OSX CMake setup script
#
# Required:
# - clang by Xcode6 or later
# - cmake
# - ninja
#