Skip to content

Instantly share code, notes, and snippets.

View diamondo25's full-sized avatar
🔥
rm -rf --no-preserve-root /

Erwin Oegema diamondo25

🔥
rm -rf --no-preserve-root /
View GitHub Profile
@diamondo25
diamondo25 / script.py
Last active February 22, 2021 18:54
Fix letsencrypt symlinks from /live to point to correct /archive entry
#!/usr/bin/env python3
# Just run this program. It'll find all 'archived' letsencrypt certs,
# and sets up the corresponding live/ entries.
# This solves the following error:
# CertStorageError: expected /etc/letsencrypt/live/example.com/cert.pem to be a symlink
import os
import re
@diamondo25
diamondo25 / cpubenchmark-extractor.js
Last active April 27, 2019 11:25
CPU Benchmark data extractor
function nameToShortName(name) {
var x = name.match(/(.* ([EiWA][0-9]+[^ ]+).*)/);
if (x != null) return x[2];
x = name.match(/(.* ([A-Za-z-]*[0-9]{3,}[A-Za-z-]*)( .*|$))/);
if (x != null) return x[2];
return name;
}
var results = {};
@diamondo25
diamondo25 / custom.css
Created January 31, 2019 10:20 — forked from RobThree/custom.css
Maak je Tweakers.net frontpage weer bruikbaar
#categoryBar, .fpaItemsWrapper, .inbetweenContent, #highlightedProducts, .secondColumn {
display: none;
}
table.highlights td {
padding: 0;
line-height: normal;
}
.mainColumn {
width: 100% !important;
}
using System;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Windows.Forms;
namespace qnd_png_conversion
{
class Program
@diamondo25
diamondo25 / maple-npc-chat.py
Last active June 16, 2020 02:13
Maple NPC chat options
enum QR {
MonsterBook = 1047,
SAVE_EXP_BUFF = 1062,
WeddingDivorce = 1103,
WeddingVows30days = 1125,
WeddingVows100days = 1126,
RecommendPartyQuestSave = 1216,
MonsterCarnival = 1301,
MonsterCarnivalS2 = 1302,
BeastFormWing_On_Off = 1544,
@diamondo25
diamondo25 / find_opcodes.idc
Created July 30, 2017 16:16
Get all references to the function, and print the first push opcode of the reference (argument)
#include <idc.idc>
static main (void) {
auto ea = ScreenEA();
auto xt;
auto r = RfirstB(ea);
Message("Function\tCall\tOpcodeAddr\tOpcode\tOpcodeHex\n");
while (r != -1) {
xt = XrefType();
@diamondo25
diamondo25 / controllers.application.js
Created November 29, 2016 11:15
2.10 'duplicate route error'
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@diamondo25
diamondo25 / application.js
Created November 25, 2016 14:28
Follow Location header in Ember
// app/adapters/application.js
import DS from 'ember-data';
// Note: In order to allow the Location header to be seen through CORS requests,
// include 'Access-Control-Expose-Headers: Location' header in your API response.
export default DS.RESTAdapter.extend({
_ajaxRequest(hash) {
let originalSuccess = hash.success;
let originalError = hash.error;
@diamondo25
diamondo25 / application.js
Created November 24, 2016 15:58
Use integer / number id in Ember without canary build
// app/serializers/application.js
import DS from 'ember-data';
import Ember from 'ember';
import coerceId from "ember-data/-private/system/coerce-id";
var get = Ember.get;
export default DS.JSONSerializer.extend({
extractId(modelClass, resourceHash) {
var primaryKey = get(this, 'primaryKey');
@diamondo25
diamondo25 / HomeController.scala
Created November 23, 2016 14:15
Pretty print Json in result in Play Framework 2.5
package controllers
import javax.inject.{Inject, Singleton}
import play.api.libs.json.Json
import play.api.mvc.{Action, Controller}
@Singleton
class HomeController @Inject() () extends Controller with PrettyJsonOutput {
def index = Action { implicit request =>