Skip to content

Instantly share code, notes, and snippets.

View DBassel's full-sized avatar

Basel Darvish DBassel

  • 1C Company
  • Moscow
View GitHub Profile
@nolim1t
nolim1t / gist:271018
Created January 7, 2010 05:29
Sample HTTP Request in Powershell
Powershell HTTP Request
$r = [System.Net.WebRequest]::Create("http://url/")
$resp = $r.GetResponse()
$reqstream = $resp.GetResponseStream()
$sr = new-object System.IO.StreamReader $reqstream
$result = $sr.ReadToEnd()
write-host $result
Username and passwords
@szpak
szpak / build.gradle
Created December 19, 2011 23:07
build.gradle with something similar to Maven's profiles
apply plugin: 'java'
apply plugin: 'signing'
version = '0.5.3-SNAPSHOT'
isReleaseVersion = !version.endsWith("SNAPSHOT")
sourceCompatibility = 1.5
//targetCompatibility has the same value as sourceCompatibility by default
//to enable fancy test reports with ReportNG
isReportNGEnabled = hasProperty("reports")
@oodavid
oodavid / README.md
Created March 26, 2012 17:05
Backup MySQL to Amazon S3

Backup MySQL to Amazon S3

This is a simple way to backup your MySQL tables to Amazon S3 for a nightly backup - this is all to be done on your server :-)

Sister Document - Restore MySQL from Amazon S3 - read that next

1 - Install s3cmd

this is for Centos 5.6, see http://s3tools.org/repositories for other systems like ubuntu etc

@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active November 17, 2024 13:10
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@rockymadden
rockymadden / build.gradle
Last active June 27, 2018 15:01
Deploy a Gradle Scala project to Maven Central, or any Maven repository for that matter, based upon the presence of variables in your gradle.properties file. Plays nicely with continuous integration tools like Travis-CI.
apply plugin: 'maven'
apply plugin: 'scala'
apply plugin: 'signing'
def isMavenDeployable = hasProperty('mavenRepositoryUrl') &&
hasProperty('mavenRepositoryUsername') &&
hasProperty('mavenRepositoryPassword')
if (isMavenDeployable) {
signing {
@ericacm
ericacm / Topic.scala
Last active June 25, 2017 06:17
Example Hibernate entity in Scala
/*
* Topic Entity
*/
@Entity
@Table(uniqueConstraints = Array(new UniqueConstraint(columnNames=Array("application_id", "name"))))
@NamedQueries(Array(
new NamedQuery(name="Topic.findAllByApplication", query="from Topic where application=:application"),
new NamedQuery(name="Topic.findByApplicationAndName", query="from Topic where application=:application and name=:name")
))
class Topic {
@emil2k
emil2k / Connectivity.java
Last active August 5, 2024 10:48
Android utility class for checking device's network connectivity and speed.
/*
* Copyright (c) 2017 Emil Davtyan
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
@devsprint
devsprint / gist:5363023
Last active November 3, 2020 02:51
Write a blob content to Cassandra using datastax\java-driver
private static String WRITE_STATEMENT = "INSERT INTO avatars (id, image_type, avatar) VALUES (?,?,?);";
private final BoundStatement writeStatement=writeStatement = session.prepare(WRITE_STATEMENT)
.setConsistencyLevel(ConsistencyLevel.LOCAL_QUORUM).bind();
try {
BoundStatement stmt = driver.getWriteStatement();
stmt.enableTracing();
stmt.setLong("id", accountId);
stmt.setString("image_type", image.getType());
stmt.setBytes("avatar", ByteBuffer.wrap(image.getBytes()));
@phoenix24
phoenix24 / sample-cluster-client
Last active May 19, 2022 18:12
sample akka cluster client.
package spikes.cluster
import akka.actor._
import com.typesafe.config.ConfigFactory
import akka.contrib.pattern.{ClusterClient, ClusterReceptionistExtension}
object DemoMaster {
def main(args: Array[String]): Unit = {
@mezis
mezis / query_finder.sql
Last active May 26, 2024 20:03
Finding long-running queries in MySQL
SELECT id,state,command,time,left(replace(info,'\n','<lf>'),120)
FROM information_schema.processlist
WHERE command <> 'Sleep'
AND info NOT LIKE '%PROCESSLIST%'
ORDER BY time DESC LIMIT 50;