Skip to content

Instantly share code, notes, and snippets.

View bostrot's full-sized avatar
🕶️
Doing some stuff here and there...

Eric Trenkel bostrot

🕶️
Doing some stuff here and there...
View GitHub Profile
@bostrot
bostrot / CustomShowDialog.dart
Last active October 25, 2022 09:25
showDialog with rounded corners
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:async';
import 'dart:ui';
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
@bostrot
bostrot / AdMobBannerOneScreen.dart
Created June 22, 2018 09:57
AdMob Banner on one screen
import 'package:flutter/material.dart';
import 'package:firebase_admob/firebase_admob.dart';
void main() => runApp(new MyApp());
BannerAd myBanner = new BannerAd(
adUnitId: BannerAd.testAdUnitId,
size: AdSize.smartBanner,
listener: (MobileAdEvent event) {
print("BannerAd event is $event");
@bostrot
bostrot / styles.xml
Created June 24, 2018 12:03
Custom MapView AppBar color Android
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
@bostrot
bostrot / site_caller.cpp
Created December 6, 2018 09:22
Posts empty body to site with cookies using libcurl to retrieve e.g. daily login bonus. Site must return code 200 when logged and another when not e.g. 404.
#include <stdio.h>
#include <curl/curl.h>
#include <iostream>
#include <unistd.h>
size_t CurlWrite_CallbackFunc_StdString(void *contents, size_t size, size_t nmemb, std::string *s)
{
size_t newLength = size * nmemb;
size_t oldLength = s->size();
try
@bostrot
bostrot / followAll.js
Created December 6, 2018 14:11
Chrome bookmarklet: Twitter follow all on this page.
javascript:(function() {var followBTNs = document.getElementsByClassName("follow-text");var follow = function() {for (var i = 0; i < followBTNs.length; i++) { followBTNs[i].click(); if (i === (followBTNs.length - 1)) { window.location.reload(); } } }; follow(); })();
@bostrot
bostrot / style.css
Last active February 16, 2019 18:57
TVMaze API Quick Search Gadget for HTML
body {padding-top:50px;}
td {
border-top: none !important;
}
.row {
padding-bottom: 10px;
}
.box {
@bostrot
bostrot / index.html
Last active February 16, 2019 19:49
HTML file for TVMaze API Quick Search GUI
<!DOCTYPE html>
<html>
<head>
<title>TV Series Search</title>
<link href="https://fonts.googleapis.com/css?family=VT323" rel="stylesheet">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
</head>
@bostrot
bostrot / ticket_handler.js
Created April 10, 2019 14:34
Quick user block
const config = require('../config.js');
const cache = require('./cache.js');
function ticketHandler(bot, ctx) {
ctx.getChat().then(function(chat) {
if (chat.id.toString() === config.staffchat_id) {
// let staff handle that
staffChat(ctx, bot, chat);
} else if (chat.type === 'private') {
// create a ticket and send to staff
@bostrot
bostrot / macropad.ino
Created January 2, 2020 12:57
Simple Arduino / Teensy macro keypad
int button[5];
bool curPressed[5];
bool pressedD = false;
bool pressedM = false;
void setup()
{
Serial.begin(38400);
}
void loop()
@bostrot
bostrot / disgusting_md5_utf16le.cpp
Created July 9, 2020 23:22
Cheap and disgusting md5 utf16le with c++ and nodejs
#include <iostream>
std::string exec(std::string cmd) {
std::string data;
FILE * stream;
const int max_buffer = 256;
char buffer[max_buffer];
cmd.append(" 2>&1");
stream = popen(cmd.c_str(), "r");