Skip to content

Instantly share code, notes, and snippets.

@ebta
ebta / open-vpn-ubuntu-20.04.md
Last active April 18, 2024 12:35
Easy way setup or install VPN OpenVPN on Ubuntu 20.04

1. Update your system

First, run the apt command to apply security updates:

sudo apt update
sudo apt upgrade

2. Download and run openvpn-install.sh script

DOwnload installation script using short url as follow and update chmod :

wget https://git.io/vpn -O openvpn-ubuntu-install.sh
@itsJoKr
itsJoKr / marker_generator.dart
Last active November 11, 2023 11:16
Quick way to convert the widget to marker, not supposed to work with images.
import 'package:flutter/material.dart';
import 'dart:typed_data';
import 'package:flutter/rendering.dart';
import 'dart:ui' as ui;
/// This just adds overlay and builds [_MarkerHelper] on that overlay.
/// [_MarkerHelper] does all the heavy work of creating and getting bitmaps
class MarkerGenerator {
final Function(List<Uint8List>) callback;
final List<Widget> markerWidgets;
@mrk-han
mrk-han / emulator-install-using-avdmanager.md
Last active May 1, 2024 21:12
Installing and creating Emulators with AVDMANAGER (For Continuous Integration Server or Local Use)

Install and Create Emulators using AVDMANAGER and SDKMANAGER

TL;DR

For an emulator that mimics a Pixel 5 Device with Google APIs and ARM architecture (for an M1/M2 Macbook):

  1. List All System Images Available for Download: sdkmanager --list | grep system-images

  2. Download Image: sdkmanager --install "system-images;android-30;google_atd;arm64-v8a"

@grantglidewell
grantglidewell / parseURL.js
Last active April 28, 2019 12:27
query string parsing util
<div>
<pre>
export function parseUrl(url) {
if (typeof url !== "string") {
console.error(`Cannot parse url of type ${typeof url}`);
return false
}
if(url.split("?").length === 1){
// console.log(`No query params are present`);
return false
@Pulimet
Pulimet / AdbCommands
Last active May 21, 2024 06:50
Adb useful commands list
adb help // List all comands
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
@micc83
micc83 / mysqldump.php
Created June 5, 2017 13:17
Simple PHP script to dump a MySql database
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$database = 'db';
$user = 'user';
$pass = 'pass';
$host = 'localhost';
@davebarnwell
davebarnwell / PHP composer tools.md
Last active May 19, 2024 20:13
Global installation of PHP tools with Composer

Global installation of PHP tools with Composer

To install a composer package globally, you run the usual require command, but with the addition of the global modifier. So to install PHPUnit, you would run:

$ composer global require phpunit/phpunit
$ composer global require phpunit/dbunit
$ composer global require phing/phing
$ composer global require phpdocumentor/phpdocumentor
$ composer global require sebastian/phpcpd
@baberali
baberali / LoggingFilter.java
Created August 15, 2016 11:48
Instead of writing your own classes to cache request response for logging, Spring provides a couple of useful classes i.e. ContentCachingRequestWrapper and ContentCachingResponseWrapper. These classes can be utilized very effectively, for example, in the following little filter:
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@gokulkrishh
gokulkrishh / media-query.css
Last active May 17, 2024 04:45
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */