Skip to content

Instantly share code, notes, and snippets.

💭
Everything not saved will be lost

Alif h4ck4life

💭
Everything not saved will be lost
Block or report user

Report or block h4ck4life

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@h4ck4life
h4ck4life / CallbackDemo.java
Created Nov 8, 2019
Java simple callback demo using Interface
View CallbackDemo.java
public class CallbackDemo {
public static void main(String[] args) throws InterruptedException {
RestApiCall restApiCall = new RestApiCall();
restApiCall.getUsersAsync(new UserListener() {
@Override
public void onDataReceived(String data) {
System.out.println(data);
}
@h4ck4life
h4ck4life / PreventSleep.cs
Created Nov 6, 2019 — forked from brianhassel/PreventSleep.cs
Prevent Computer Sleep in C#
View PreventSleep.cs
internal static class NativeMethods {
public static void PreventSleep() {
SetThreadExecutionState(ExecutionState.EsContinuous | ExecutionState.EsSystemRequired);
}
public static void AllowSleep() {
SetThreadExecutionState(ExecutionState.EsContinuous);
}
@h4ck4life
h4ck4life / vpn.md
Created Oct 23, 2019 — forked from joepie91/vpn.md
Don't use VPN services.
View vpn.md

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

A Russian translation of this article can be found here, contributed by Timur Demin. There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.

Why not?

@h4ck4life
h4ck4life / deployment-tool-ansible-puppet-chef-salt.md
Created Oct 22, 2019 — forked from jaceklaskowski/deployment-tool-ansible-puppet-chef-salt.md
Choosing a deployment tool - ansible vs puppet vs chef vs salt
View deployment-tool-ansible-puppet-chef-salt.md

Requirements

  • no upfront installation/agents on remote/slave machines - ssh should be enough
  • application components should use third-party software, e.g. HDFS, Spark's cluster, deployed separately
  • configuration templating
  • environment requires/asserts, i.e. we need a JVM in a given version before doing deployment
  • deployment process run from Jenkins

Solution

@h4ck4life
h4ck4life / media-query.css
Created Sep 10, 2019 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
View media-query.css
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@h4ck4life
h4ck4life / .gitignore
Created Jul 23, 2019 — forked from mchelen/.gitignore
example: browserify + jquery + grunt
View .gitignore
*~
bundle.js
bundle.min.js
node_modules
@h4ck4life
h4ck4life / dev-machine.sh
Created Jun 26, 2019
Install all the necessary tools for a developer machine on Ubuntu 14.04
View dev-machine.sh
#!/bin/bash
# All the configuration settings described below were found on the internet,
# and this script just automates it
# Generating locales
sudo locale-gen en_US en_US.UTF-8 pt_BR pt_BR.UTF-8 es_ES es_ES.UTF-8
# Installing base packages
sudo apt-get update
View Adding Images to markdown files in Gist.markdown

How To - Upload and add Images to markdown files in Gist

Markdown files allow embedding images in it. However it requires the image to be hosted at some location and we can add the url of the image to embed it.

Example: ![Alternate image text](https://someurl/imagelocation/image.png)

We can use services like imgur or other services to host the images and use the hosted URL.

@h4ck4life
h4ck4life / main.dart
Created Dec 10, 2018 — forked from StrykerKKD/main.dart
Web scraping with Dart 2
View main.dart
import 'dart:async';
import 'package:http/http.dart' as http;
import 'package:html/parser.dart' as parser;
import 'package:html/dom.dart';
main() async {
http.Response response = await http.get('https://news.ycombinator.com/');
Document document = parser.parse(response.body);
@h4ck4life
h4ck4life / gist:aa27b0e897091f8aeec745661ac1753d
Created Aug 15, 2018 — forked from thomasgriffin/gist:4733283
Map subdomains to URLs in nginx with WordPress.
View gist:aa27b0e897091f8aeec745661ac1753d
server {
listen 80;
listen 443 ssl;
server_name ~^(?<user>[a-zA-Z0-9-]+)\.example\.com$;
location / {
resolver 8.8.8.8;
rewrite ^([^.]*[^/])$ $1/ permanent;
proxy_pass_header Set-Cookie;
proxy_pass $scheme://example.com/user/$user$request_uri;
You can’t perform that action at this time.